package cc.admin.modules.graduate.service.impl;

import cc.admin.modules.graduate.entity.BlankErrorQuestions;
import cc.admin.modules.graduate.entity.BlankQuestions;
import cc.admin.modules.graduate.entity.DesignAnswerList;
import cc.admin.modules.graduate.mapper.BlankErrorQuestionsMapper;
import cc.admin.modules.graduate.service.IBlankErrorQuestionsService;
import cc.admin.modules.graduate.service.IDesignQuestionsListService;
import me.zhyd.oauth.utils.UuidUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description: 填空题
 * @Author: cc-admin
 * @Date:   2025-02-03
 * @Version: V1.0.0
 */
@Service
public class BlankErrorQuestionsServiceImpl extends ServiceImpl<BlankErrorQuestionsMapper, BlankErrorQuestions> implements IBlankErrorQuestionsService {

    @Autowired
    BlankErrorQuestionsMapper blankErrorQuestionsMapper;

    @Autowired
    IDesignQuestionsListService designQuestionsListService;


    @Override
    public void saveErrorBlank(BlankQuestions blankQuestions,String blankAnswer,String userId) {
        BlankErrorQuestions blankErrorQuestions = new BlankErrorQuestions();
        String id = UuidUtils.getUUID();
        BeanUtils.copyProperties(blankQuestions,blankErrorQuestions);
        blankErrorQuestions.setQuestionId(blankQuestions.getId());
        blankErrorQuestions.setId(id);
        blankErrorQuestions.setUserId(userId);
        blankErrorQuestions.setStudentAnswer(blankAnswer);
        blankErrorQuestions.setStudentId(blankQuestions.getCreateBy());
        blankErrorQuestionsMapper.insert(blankErrorQuestions);
    }

    @Override
    public void saveDesignAnswer(DesignAnswerList designAnswerList) {
//        List<DesignAnswerList> errorDesign = designQuestionsListService.getErrorDesign();
//        System.out.println(designAnswerList);
    }
}
